// Copyright: personal possession of Nguyen Minh Kha
// Class use manage sound in game.
// Date time: 05:40PM 07/12/2011(mm/dd/yyyy)
// License: free source
// Version: 1.0
// Writer: Nguyen Minh Kha

#ifndef GAMEFRAMEWORK_AUDIO_H_
#define GAMEFRAMEWORK_AUDIO_H_

#include <dsound.h>

#include <mad.h> // extern open source library

#include "log.h"


class Audio
{
  /* Static */
public:
  static Audio *audio;

  //
  // Constructor, destructor
  //

public:
  Audio(void);
  ~Audio(void);

  //
  // Method
  //

public:
  bool Init(HWND hWnd);
  void Release();
  // Only support 16 bit per sample and 4 byte align, 2 channel.
  LPDIRECTSOUNDBUFFER8 CreateSoundBuffer(mad_pcm *pcm, int &bufferSize);
  LPDIRECTSOUND8 getDirectSound() {return directSound8;}

  //
  // Data member
  //

private:
  // directsound variable
  LPDIRECTSOUND8 directSound8;
  
  // report interface
  HRESULT hResult;
};

#endif // GAMEFRAMEWORK_AUDIO_H_

